home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 37 / IOPROG_37.ISO / SOFT / Multilizer.exe / disk1 / data1.cab / data1 / [Group9]VCL Source Standard / ivtargd.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-12  |  2.2 KB  |  102 lines

  1. unit IvTargD;
  2.  
  3. {$I IVMULTI.INC}
  4.  
  5. interface
  6.  
  7. uses
  8. {$IFDEF WIN32}
  9.   Windows,
  10. {$ELSE}
  11.   WinTypes, WinProcs,
  12. {$ENDIF}
  13.   Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
  14.   IvMulti, ExtCtrls;
  15.  
  16. type
  17.   TIvTargetPropertyDialog = class(TForm)
  18.     OKButton: TButton;
  19.     CancelButton: TButton;
  20.     ClassLabel: TLabel;
  21.     PropertyLabel: TLabel;
  22.     ClassNameEdit: TEdit;
  23.     PropertyNameEdit: TEdit;
  24.     HelpButton: TButton;
  25.     TypeRadio: TRadioGroup;
  26.     procedure HelpButtonClick(Sender: TObject);
  27.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  28.     procedure FormCreate(Sender: TObject);
  29.  
  30.   private
  31.     FExclusiveComponent: Boolean;
  32.  
  33.   public
  34.     procedure SetItem(value: TIvTargetProperty);
  35.  
  36.     property ExclusiveComponent: Boolean read FExclusiveComponent write FExclusiveComponent;
  37.   end;
  38.  
  39. implementation
  40.  
  41. {$R *.DFM}
  42.  
  43. uses
  44.   IvDictio;
  45.   
  46. procedure TIvTargetPropertyDialog.SetItem(value: TIvTargetProperty);
  47. begin
  48.   ClassNameEdit.Text := value.TargetClassName;
  49.   PropertyNameEdit.Text := value.TargetPropertyName;
  50.   TypeRadio.ItemIndex := Integer(value.TargetType);
  51. end;
  52.  
  53. procedure TIvTargetPropertyDialog.HelpButtonClick(Sender: TObject);
  54. begin
  55. {$IFDEF WIN32}
  56.   WinHelp(
  57.     Handle,
  58.     PChar(GetMLRegistryValue('RootDir', '') + '\docs\ivmulti.hlp'),
  59.     HELP_CONTEXT,
  60.     20001);
  61. {$ENDIF}
  62. end;
  63.  
  64. procedure TIvTargetPropertyDialog.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  65. begin
  66.   if ModalResult <> idOK then
  67.     CanClose := True
  68.   else
  69.   begin
  70.     if (ClassNameEdit.Text = '') and (PropertyNameEdit.Text = '') then
  71.     begin
  72.       MessageDlg(
  73.         'Can not add an empty target',
  74.         mtError,
  75.         [mbOK],
  76.         0);
  77.       CanClose := False;
  78.     end
  79.     else if (TypeRadio.ItemIndex = 1) and (ClassNameEdit.Text = '') and FExclusiveComponent then
  80.     begin
  81.       MessageDlg(
  82.         'You must give the class/component name for an exclusive target',
  83.         mtError,
  84.         [mbOK],
  85.         0);
  86.       CanClose := False;
  87.     end
  88.     else
  89.       CanClose := True;
  90.   end;
  91. end;
  92.  
  93. procedure TIvTargetPropertyDialog.FormCreate(Sender: TObject);
  94. begin
  95. {$IFNDEF WIN32}
  96.   HelpButton.Hide;
  97. {$ENDIF}
  98.   FExclusiveComponent := True;
  99. end;
  100.  
  101. end.
  102.